﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BusinessLogic;
using DataModels;
using Website.Models;

namespace Website.Controllers
{
    public class HomeController : Controller
    {
        private JobsBusinessLogic _jobs = new JobsBusinessLogic();

        public ActionResult Index()
        {
            IEnumerable<Jobs> temp = _jobs.GetTop10Jobs();
            List<JobsModel> jobs = new List<JobsModel>(temp.Count());
            foreach(Jobs item in temp)
            {
                jobs.Add(new JobsModel { Date = item.StartTime, Position = item.Title, Company = item.Company.FullName });
            }

            return View(jobs);
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
